package com.jianguozh.difs.support.service.sys.mapper;

import com.jianguozh.difs.support.service.sys.entity.Res;
import com.jianguozh.difs.support.service.sys.entity.Role;
import com.jianguozh.difs.support.service.sys.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * <p>
 * 用户 Mapper 接口
 * </p>
 *
 * @author hanrs
 * @since 2022-03-17
 */
public interface UserMapper extends BaseMapper<User> {

    /**
     * 获取用户所有角色
     *
     * @param userId
     * @return
     */
    List<Role> selectUserRole(@Param("userId") String userId);

    /**
     * 获取用户在指定client下的资源
     *
     * @param userId
     * @param clientId
     * @return
     */
    List<Res> selectListUserClientRes(@Param("userId") String userId, @Param("clientId") String clientId);

    void insertUserRole(@Param("userId") String userId, @Param("roleIds") List<String> roleIds);

    void deleteUserRole(@Param("userId") Serializable userId);

    void deleteBatchUserRole(@Param("userIds") Collection<?> userIds);


}
